#pragma once

#include<iostream>
#include<pthread.h>
#include<signal.h>
#include"TcpServer.hpp"

#define PORT 8081

class HttpServer{
    private:
    int port;
    bool stop;

    public:
    HttpServer(int _port=PORT):port(_port),stop(false)
    {}

    void InitServer()
    {
        signal(SIGPIPE,SIG_IGN);
    }

    //循环进行
    void loop()
    {
        TcpServer* tsvr=TcpServer::getinstace(port);

        while(!stop)
        {
            struct sockaddr_in peer;
            socklen_t len=sizeof(peer);
            int sock=accept(tsvr->Sock(),(struct  sockaddr*)&peer,&len);
            if(sock<0)            
            {
                continue;
            }


        }
    }

    ~HttpServer()
    {}

};